#include <cstdio>
#include <memory.h>
#include <cmath>

#define eps 1e-8

double x[ 8 ], y[ 8 ], vx[ 8 ], vy[ 8 ], v, xx0, yy0, ans;
int n;
bool visit[ 8 ];

void init( )
{
    int i;
    memset( visit, 0, sizeof( visit ) );
    for ( i = 0; i < n; i++ )
        scanf("%lf%lf%lf%lf", &x[ i ], &y[ i ], &vx[ i ], &vy[ i ]);
    scanf("%lf%lf%lf", &xx0, &yy0, &v);
    ans = 1;
    for ( i = 0; i < 10; i++ ) ans *= 10;
}

double calc( double xx, double yy, int p, double t )
{
    double l = 0, r = 1000000, m;
    double x2, y2;
    while ( ( r - l ) > eps )
    {
        m = ( l + r ) / 2;
        x2 = x[ p ] + vx[ p ] * ( m + t );
        y2 = y[ p ] + vy[ p ] * ( m + t );
        if ( sqrt( ( x2 - xx ) * ( x2 - xx ) + ( y2 - yy ) * ( y2 - yy ) ) / v > m )
            l = m;
        else
            r = m;
    }
    return l;
}

void dfs( double xx, double yy, double t )
{
    int i;
    bool flag = true;
    double tt1, tt2, tt, tx, ty, a, b, c;
    if ( t > ans ) return ;
    for ( i = 0; i < n; i++ )
        if ( !visit[ i ] )
        {
            flag = false;
            visit[ i ] = true;
            a =  vx[ i ] * vx[ i ] + vy[ i ] * vy[ i ] - v * v;
            b = -( 2 * vx[ i ] * ( xx - x[ i ] - vx[ i ] * t ) + 2 * vy[ i ] * ( yy - y[ i ] - vy[ i ] * t ) );
            c = ( vx[ i ] * t + x[ i ] - xx ) * ( vx[ i ] * t + x[ i ] - xx ) + ( yy - y[ i ] - vy[ i ] * t ) * ( yy - y[ i ] - vy[ i ] * t );
            tt1 = ( -b + sqrt( b * b - 4 * a * c ) ) / 2 / a;
            tt2 = ( -b - sqrt( b * b - 4 * a * c ) ) / 2 / a;
            //tt = calc( xx, yy, i, t );
            //printf("%lf %lf %lf %lf %lf %lf\n", a, b, c, tt1, tt2, tt);
            //if ( tt1 >= 0 - eps )
            //    dfs( x[ i ] + vx[ i ] * ( t + tt1 + 1 ), y[ i ] + vy[ i ] * ( t + tt1 + 1 ), t + tt1 + 1 );
            //if ( tt2 >= 0 - eps )
                dfs( x[ i ] + vx[ i ] * ( t + tt2 + 1 ), y[ i ] + vy[ i ] * ( t + tt2 + 1 ), t + tt2 + 1 );
            //dfs( x[ i ] + vx[ i ] * ( t + tt + 1 ), y[ i ] + vy[ i ] * ( t + tt + 1 ), t + tt + 1 );
            visit[ i ] = false;
        }
    if ( flag )
    {
        t += sqrt( ( xx - xx0 ) * ( xx - xx0 ) + ( yy - yy0 ) * ( yy - yy0 ) ) / v;
        if ( ans > t )
            ans = t;
    }
}

void print( )
{
    int hour, minute, second;
    ans *= 3600;
    hour = int( ans / 3600 + eps );
    ans -= hour * 3600;
    minute = int( ans / 60 + eps );
    ans -= minute * 60;
    second = int( ceil( ans ) + eps );
    if ( second == 60 )
    {
        second = 0;
        minute++;
    }
    if ( minute == 60 )
    {
        minute = 0;
        hour++;
    }
    printf("%d hour(s) %d minute(s) %d second(s)\n", hour, minute, second);
}

int main( )
{
    int t = 1;
    while ( scanf("%d", &n) && n )
    {
        init( );
        dfs( xx0, yy0, 0 );
        printf("Case %d: ", t++);
        print( );
    }
    return 0;
}
